﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Text;

namespace AppSocketModel
{
    /// <summary>
    /// 设备信息
    /// </summary>
    [BsonIgnoreExtraElements]
    public class DeviceDto
    {
        /// <summary>
        /// Id
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        [BsonRepresentation(BsonType.ObjectId)]
        public string Id { get; set; }


        /// <summary>
        /// IMEI
        /// </summary>
        public string IMEI { set; get; }

        /// <summary>
        /// ICCID  集成电路卡识别码（固化在手机SIM卡中） ICCID为IC卡的唯一识别号码，共有20位数字组成
        /// </summary>
        public string ICCID { set; get; }

        /// <summary>
        /// 设备重启次数
        /// </summary>
        public long ResetCount { set; get; }

        /// <summary>
        /// 设备总重启次数
        /// </summary>
        public long ResetTotal { set; get; }

        /// <summary>
        /// 重置前设备总重启次数
        /// </summary>
        public long FristResetTotal { set; get; }

        /// <summary>
        /// 重置后设备总重启次数
        /// </summary>
        public long LastResetCount { set; get; }

        /// <summary>
        /// 数据发送时间间隔(秒)
        /// </summary>
        public int TimeSpan { set; get; }

        /// <summary>
        /// 设备休眠时间(分钟)
        /// </summary>
        public int SleepTime { set; get; }

        /// <summary>
        /// 发生异常时设备休眠时间(分钟)
        /// </summary>
        public int SleepTimeOnErr { set; get; }

        /// <summary>
        /// 唤醒后数据发送次数
        /// </summary>
        public int SendTimes { set; get; }

        /// <summary>
        /// 电池电压
        /// </summary>
        public float BatteryVoltage { set; get; }

        /// <summary>
        /// 唤醒类型
        /// </summary>
        public string WakeUpType { set; get; }

        /// <summary>
        /// GPRS模块型号
        /// </summary>
        public string GprsModule { set; get; }

        /// <summary>
        /// 硬件版本号
        /// </summary>
        public string HardwareVersion { set; get; }

        /// <summary>
        /// 硬件代码
        /// </summary>
        public string HardwareCode { set; get; }

        /// <summary>
        /// 固件版本号
        /// </summary>
        public string FirmwareVersion { set; get; }

        /// <summary>
        /// 固件代码
        /// </summary>
        public string FirmwareCode { set; get; }

        /// <summary>
        /// 在线时长 秒
        /// </summary>
        public long OnLineTime { set; get; }

        /// <summary>
        /// 离线时长 秒
        /// </summary>
        public long OffLineTime { set; get; }


        /// <summary>
        /// 首次注册时间
        /// </summary>
        public DateTime FristLoginTime { set; get; }

        /// <summary>
        /// 最新注册时间
        /// </summary>
        public DateTime LastLoginTime { set; get; }

        /// <summary>
        /// 最新数据时间
        /// </summary>
        public DateTime LastDataTime { set; get; }

        /// <summary>
        /// 注册总次数
        /// </summary>
        public long LoginTimes { set; get; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime ModifyTime { set; get; }

        /// <summary>
        /// 设备类型
        /// </summary>
        public  DeviceType deviceType { set; get; }

        /// <summary>
        /// 设备类型描述
        /// </summary>
        public string DeviceTypeStr
        {
            get
            {
                return deviceType.GetDescriptionString();
            }
        }

        /// <summary>
        /// 在线时长描述
        /// </summary>
        public string OnLineTimeString { set; get; }

        /// <summary>
        /// 离线时长描述
        /// </summary>
        public string OffLineTimeString { set; get; }

        /// <summary>
        /// GPS有效定位数据总数
        /// </summary>
        public long GpsValidDataCount { set; get; }

        /// <summary>
        /// GPS无效定位数据总数
        /// </summary>
        public long GpsInValidDataCount { set; get; }

        /// <summary>
        /// LBS有效定位数据总数
        /// </summary>
        public long LbsValidDataCount { set; get; }

        /// <summary>
        /// LBS无效定位数据总数
        /// </summary>
        public long LbsInValidDataCount { set; get; }

        /// <summary>
        /// 重置时间
        /// </summary>
        public DateTime  ResetCountTime { set; get; }

        /// <summary>
        ///  重置次数
        /// </summary>
        public int ResetCountTimes { set; get; }

        /// <summary>
        /// 待重置
        /// </summary>
        public bool IsNeedReset { set; get; }

        /// <summary>
        /// 待重置
        /// </summary>
        public string IsNeedResetStr
        {
            get
            {
                return IsNeedReset ? "Y" : "N";
            }
        }
    }
}
